<%@page isELIgnored="false" import="java.net.*" %>
<%@taglib prefix="tiles" uri="struts-tiles" %>
<%@taglib prefix="html" uri="struts-html" %>
<%@taglib prefix="fn" uri="jstl-fn" %>
<%@taglib prefix="mcfn" uri="mcfn" %>
<%@taglib prefix="bean" uri="struts-bean" %>
<%@taglib prefix="c" uri="jstl" %>

<c:set var="ResAsset"></c:set><c:set var="AssetsLength" value="${fn:length(FlowData.assets)}"/><c:set var="AssetsLengthLast" value="${fn:length(FlowData.assets) - 1}"/><c:forEach items="${FlowData.assets}" var="asset" varStatus="assetStatus"><c:set var="ResAsset">${ResAsset} ${asset.nombre}<c:if test="${assetStatus.index lt AssetsLengthLast}">,</c:if></c:set></c:forEach>
<center>
<br/>
<c:set var="productos"/>
<c:forEach items="${FlowData.campania.tblProductos}" var="prods" varStatus="st" >
    <c:if test="${st.count eq 1}"> <c:set  var="productos" value="${prods.nombre}"/> </c:if>
    <c:if test="${st.count ne 1}"> <c:set  var="productos" value="${productos} - ${prods.nombre}"/> </c:if>
</c:forEach>
<table style="width: 800px;">
<!--<tr>
    <td style="width: 100%; "><h2>Tarea : ${ResAsset}</h2></td>
</tr>
<tr>
	<td style="width: 100%; ">Cuenta: ${UserLogin.actualCountName}</td>
</tr>
<tr>
	<td style="width: 100%; ">Nombre de Campa&ntilde;a: ${FlowData.campania.nombre}</td>
</tr>-->
<tr>
	<td style="width: 100%; ">&nbsp;<font color="red">${FlowData.error}</font></td>
</tr>

<!--<html:form method="post" styleId="ContratoForm"  action="/Contrato" >-->
<tr>
        
    <td>
        
        <table class="tabForms" border="0">
            
            <tr class="alt">
                <td>
                    <b>Customer Name/Strategic Partner:</b>
                </td>
                <td>
                    ${FlowData.campania.tblCuenta.descripcion}
                </td>
            </tr>
            <input type="hidden" name="cveCamapnia" id="cveCamapnia" value="${FlowData.campania.cveCampania}"/>
            <tr>
                <td>
                    <b>Customer Contact: </b>
                    ${FlowData.campania.tblUsuario2.nombre}
                </td>
                <td>
                    <table style="width: 100%;">
                        <tr>
                            <td><b>Name:</b></td>
                            <td>${FlowData.campania.tblUsuario2.nombre} </td>
                        </tr>
                        <tr>
                            <td><b>Department:</b></td>
                            <td>&nbsp;&nbsp;</td>
                        </tr>
                    </table>
                </td>
            </tr>
            
            <tr class="alt">
                <td>
                    <b>Name of Initiative:</b>  
                </td>
                <td>
                    ${FlowData.campania.nombre}
                </td>
            </tr>
            
            <tr>
                <td>
                    <b>Clear and Full Description of the Mechanics (how the Initiative will work):</b>     
                </td>
                <td>
                    ${FlowData.campania.texto}
                </td>
            </tr>
            
            <tr class="alt">
                <td>
                    <b>Marketing Initiative Period:</b>
                </td>
                <td>
                    <table style="width: 100%;">
                        <tr>
                            <td><b>Event Date:</b></td>
                            <td>&nbsp;&nbsp;</td>
                            <td><b>Results Due Date:</b></td>
                            <td>${mcfn:formatTimestamp(FlowData.campania.fechaFin,'dd/MM/yyyy') }</td>
                        </tr>
                        <tr>
                            <td><b>Target Start Date:</b></td>
                            <td>${mcfn:formatTimestamp(FlowData.campania.fechaIni,'dd/MM/yyyy') }</td>
                            <td><b>Names Due Date:</b></td>
                            <td>&nbsp;&nbsp;</td>
                        </tr>
                        <tr>
                            <td><b>Target End Date:</b></td>
                            <td>${mcfn:formatTimestamp(FlowData.campania.fechaFin,'dd/MM/yyyy') }</td>
                            <td><b>Channel:</b></td>
                            <td><input type="text" name="channel" id="channel"/></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td></td>
                            <td><b>Target Public:</b></td>
                            <td>&nbsp;&nbsp;</td>
                        </tr>
                    </table>
                </td>
            </tr>
            
            <tr>
                <td>
                    <b>Activity Type: (please circle)</b>                    
                </td>
                <td>
                    ${FlowData.campania.tblTipoCampania.nombre}
                </td>
            </tr>
            
            <tr class="alt">
                <td>
                    <b>Eligibility:</b>
                </td>
                <td>
                    <table style="width: 100%;">
                        <tr>
                            <td><b>Employees:</b></td>
                            <td><input type="checkbox" name="employees" id="employees"/></td>
                            <td><b>Dept/Business Unit:</b></td>
                            <td><input type="text" name="bcUnit" id="bcUnit"/></td>
                        </tr>
                        <tr>
                            <td><b>Cardholders: </b></td>
                            <td><input type="checkbox" name="cardholders" id="cardholders"/></td>
                            <td><b>Consumer Segment/Product:</b></td>
                            <td>${productos}
                                <input type="hidden" name="cSegment" id="cSegment" value="${productos}"/>
                            </td>
                        </tr>
                        <tr>
                            <td><b>Other:</b></td>
                            <td><input type="text" name="other" id="other"/></td>
                            <td><b>Define:</b></td>
                            <td><input type="text" name="define" id="define"/></td>
                        </tr>
                        
                    </table>
                </td>
            </tr>
            
            <tr>
                <td>
                    <b>Government Approval Required (for Consumer Promotion):</b>
                </td>
                <td>
                    <table style="width: 100%;">
                        <tr>
                            <td><b>Yes</b></td>
                            <td><input type="text" name="approvalSI" id="approvalSI"/></td>
                            <td><b>No*</b></td>
                            <td><input type="text" name="approvalNO" id="approvalNO"/></td>
                        </tr>
                    </table>
                </td>
            </tr>
                        
<c:set var="AllProductsLength" value="${fn:length(FlowData.campania.tblTipoProductos)}" />
<c:set var="TableAssetColPercentage" value="${25}" />
<c:set var="TableProductColPercentage" value="${( 100 - TableAssetColPercentage ) / AllProductsLength }" />
<c:set var="DucA" value="${FlowData.meses}" />

<c:choose>
    <c:when test="${FlowData.campania.tblTipoCampania.cveTipoCampania eq 2 }">
        <tr class="alt">
            <td>
                <b>New Cards:</b>
            </td>
    <td>
        
        <table width="100%" border="0">
<c:forEach items="${FlowData.campania.tblProductos}" var="cpaw" varStatus="cpawStatus" >
            <tr>
                <td><b>Type of Program (${cpawStatus.count}):</b></td>
                <td><b>Business As Usual:</b></td>
                <td><b>Estimated Incremental:</b></td>
                <td><b>Total New Cards:</b></td>
            </tr>
            
            <tr>
                <td>${cpaw.nombre}</td>
                <td>&nbsp;&nbsp;</td>
        <c:forEach items="${FlowData.ttp}" var="ttp" varStatus="ttpStatus" >
            <c:if test="${cpawStatus.count eq ttpStatus.count}">
                <td>${ttp}</td>
                <td>${ttp}</td>
            </c:if>
                
        </c:forEach>        
                
            </tr>    
</c:forEach>
        </table>
        
    </td>
</tr>

    </c:when>
                        <c:when test="${FlowData.campania.tblTipoCampania.cveTipoCampania eq 7 }">
                            <table width="100%" border="0">
                                <tr>
                                    <td colspan="2">
                                        &nbsp;&nbsp;&nbsp;
                                    </td>
                                </tr>
                            </table>                        
                        </c:when>            
    <c:otherwise>       
            <tr class="alt">
            
            <td>
                <b>GDV:</b>
            </td>
            
            <td>
                
                <table width="100%" border="0">
<c:forEach items="${FlowData.campania.tblProductos}" var="cpaw" varStatus="cpawStatus" >
            <tr>
                <td><b>Type of Program (${cpawStatus.count}):</b></td>
                <td><b>Business As Usual:</b></td>
                <td><b>Estimated Incremental:</b></td>
                <td><b>Total New Cards:</b></td>
            </tr>
            
            <tr>
                <td>${cpaw.nombre}</td>
                <td>&nbsp;&nbsp;</td>
       <c:forEach items="${FlowData.campania.tblCampaniaProductoUsuarios}" var="cpu" varStatus="cpuStatus" >
            <c:if test="${cpu.tblProducto.cveProducto eq cpaw.cveProducto}">
                <td>${cpu.gdvTotalDelProducto}</td>
                <td>${cpu.gdvTotalDelProducto}</td>
            </c:if>                
        </c:forEach>

                
            </tr>    
</c:forEach>
                </table>
                
            </td>
            
        </tr>
								 	
    </c:otherwise>
</c:choose>                                                      
                       
<tr>
    <td> <b>Target Assumptions Rationale:</b> </td>
    <td> <input type="text" name="assumptions" id="assumptions"/> </td>
</tr>

<tr class="alt">
    <td> <b> MasterCard Support: </b> </td>
    
    <td>
        
        <table width="100%" border="0">
            <tr>
                <td><b>Asset</b></td>
                <td><b>Packages</b></td>
            </tr>
            
<c:set value="${FlowData.assetS}" var="Assets"/>
<c:set value="${fn:length(FlowData.campania.tblPaquetes)}" var="paketes"/>
<c:forEach items="${Assets}" var="asset" varStatus="assetStatus">
            <tr>
                <td>${asset.nombre}</td>
                <td>${asset.quantityOfPackage }</td>
            </tr>
</c:forEach>
            
            <tr>
                <td> <b> Budget Origin </b> </td>
                <td> <input type="text" name="budget" id="budget"/> </td>
            </tr>
            
            <tr>
                <td> <b> # of Assets (Tickets) </b> </td>
                <td> ${paketes} </td>
            </tr>
            
        </table>
        
    </td>
    
</tr>

<tr>
    <td> <b> Confirmation of Customer Contribution:  </b> </td>
    <td>
        
        <table width="100%" border="0">
            <tr>
                <td><b>Estimated Implementation Costs US$</b></td>
                <td>&nbsp;&nbsp;</td>
            </tr>
        </table>
        
    </td>
</tr>

<tr class="alt">
    <td>
        <b> Details of Investment (please comment and identify type of investment 
            - communication costs: radio / tv / direct mail, travel expenses, any other additional  </b>
    </td>
    <td> &nbsp;&nbsp; </td>
</tr>

<tr>
    <td> <b> MasterCard: </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
    <td> <b> Strategic Partner: </b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
</tr>
<tr class="alt">
    <td> <b> MasterCard International Incorporated </b> </td>
    <td> <b> Insert Legal Entity Name </b> ${FlowData.campania.tblCuenta.descripcion} </td>
</tr>
<tr>
    <td> <b> By: </b> </td>
    <td> <b> By: </b> </td>
</tr>
<tr class="alt">
    <td> <b> Name: </b> </td>
    <td> <b> Name: </b> </td>
</tr>
<tr>
    <td> <b> Title: </b> </td>
    <td> <b> Title: </b> </td>
</tr>
<tr class="alt">
    <td> <b> Date: </b> </td>
    <td> <b> Date: </b> </td>
</tr>
<tr>
    <td> <b>  </b> </td>
    <td> <b> Strategic Partner: </b> </td>
</tr>
<tr class="alt">
    <td> <b>  </b> </td>
    <td> <b> Strategic Partner Address: </b> </td>
</tr>       
        </table>
        
    </td>
    
</tr>


<tr>
	<td style="width: 100%; ">&nbsp;</td>
</tr>
<tr>
	<td>
		<table style="width: 100%;">
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td>
                            &nbsp;
                        </td>
                    </tr>
			<tr>
<!--                            <td align="center">&nbsp;</td>                            -->
<td>
    
                                                        
                                                        <input type="hidden" name="cveCamapnia" id="cveCamapnia" value="${FlowData.campania.cveCampania}"/>
                                                        <input type="hidden" name="cveWorkPreimplementation" id="cveWorkPreimplementation" value="${FlowData.tblTareaPreimplementacion.cveTareaPreimplementacion}" />
                                                        <input type="button" value="Generar Contrato" onclick="document.ContratoForm.submit(); target='_blank'  " />
<!--                                                    </html:form>-->
</td>
<td align="center">&nbsp;</td>
			</tr>
		</table>
	</td>
</tr>
<tr>
    <td>
        &nbsp; <!--        <input type="button" value="Enterado" onclick="if( confirm( 'Confirmas de enterado?' ) ) processExit( 'Ok' );" />-->
    </td>    
</tr>

</table>
</center>